package opera;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        int currentSize=bookList.getUsedSize();
        System.out.print("请输入需要查询的书名：");
        String name=scanner.nextLine();

        for (int i = 0; i < currentSize; i++) {
            if(name.equals(bookList.getBooks(i).getName())) {
                System.out.println(bookList.getBooks(i));
                return;
            }
        }
        System.out.println("未查询到此书！");
    }
}
